package org.ilead.iserve.model;

import java.sql.Timestamp;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.ilead.iserve.util.DateTimeUtil;

/**
 * News entity.
 * 
 * @author MyEclipse Persistence Tools
 */

@SuppressWarnings("serial")
@Entity
@Table(name = "news", catalog = "lop")
public class News implements java.io.Serializable {

	// Fields

	private Long id;
	/**
	 * 0 为公告 >0 新闻类型
	 */
	private Long categoryId;

	/**
	 * 标题
	 */
	private String title;

	/**
	 * 新闻展示图
	 */
	private String image;
	/**
	 * 新闻概要 或者 副标题
	 */
	private String outline;

	/**
	 * 关键词
	 */
	private String keyWords;
	/**
	 * 新闻申请人
	 */
	private String operator;
	/**
	 * 新闻的作者或者来源
	 */
	private String author;
	/**
	 * 新闻的内容
	 */
	private String content;
	/**
	 * 新闻的审核人
	 */
	private String auditor;
	/**
	 * 创建时间
	 */
	private Timestamp gmtCreate;
	/**
	 * 修改时间
	 */
	private Timestamp gmtModify;

	/**
	 * 状态 1 正常 0 删除状态
	 */
	private Short status;
	/**
	 * 当前日期
	 */
	private int isNew;

	// Constructors

	/** default constructor */
	public News() {
	}

	/** full constructor */
	public News(Long categoryId, String title, String image, String outline,
			String keyWords, String operator, String author, String content,
			String auditor, Timestamp gmtCreate, Timestamp gmtModify,
			Short status, int isNew) {
		this.categoryId = categoryId;
		this.title = title;
		this.image = image;
		this.outline = outline;
		this.keyWords = keyWords;
		this.operator = operator;
		this.author = author;
		this.content = content;
		this.auditor = auditor;
		this.gmtCreate = gmtCreate;
		this.gmtModify = gmtModify;
		this.status = status;
		this.isNew = isNew;
	}

	// Property accessors

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getImage() {
		return this.image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getOutline() {
		return this.outline;
	}

	public void setOutline(String outline) {
		this.outline = outline;
	}

	public String getKeyWords() {
		return this.keyWords;
	}

	public void setKeyWords(String keyWords) {
		this.keyWords = keyWords;
	}

	public String getOperator() {
		return this.operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public String getAuthor() {
		return this.author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getAuditor() {
		return this.auditor;
	}

	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}

	public Timestamp getGmtCreate() {
		return this.gmtCreate;
	}

	public void setGmtCreate(Timestamp gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Short getStatus() {
		return this.status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	public int getIsNew() {
		int result = 0;
		if (this.gmtModify != null) {
			if (this.gmtModify.after(DateTimeUtil.getDateTimeTimestamp())) {
				result = 1;
			}
		}
		return result;
	}

	public void setIsNew(int isNew) {
		this.isNew = isNew;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	public Timestamp getGmtModify() {
		return gmtModify;
	}

	public void setGmtModify(Timestamp gmtModify) {
		this.gmtModify = gmtModify;
	}

}